import { bannerGet, IBannerType } from "./../api/home";
import { defineStore } from "pinia";
interface IBannerState {
  list: Array<IBannerType>;
}
export const useBanner = defineStore("banner", {
  state: (): IBannerState => {
    return {
      list: [],
    };
  },
  actions: {
    //异步action
    async bannerGetAct() {
      let res = await bannerGet();
      this.list = res.data.results;
    },
    bannerAdd(payload: IBannerType) {
      this.list.push(payload);
    },
  },
});
